﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TarreOA.TarreOABLL;
using TarreOA.TarreOAModels;

public partial class admin_AttendanceTimeManage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            AttendanceTime attendanceTime = AttendanceTimeManager.showIt(Server.MapPath(@"~/companyFiles/AttendanceTime.xml"));
            txtBackAM.Text = attendanceTime.BackAM;
            txtBackPM.Text = attendanceTime.BackPM;
            txtComeAM.Text = attendanceTime.ComeAM;
            txtComePM.Text = attendanceTime.ComePM;
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        AttendanceTime attendanceTime = new AttendanceTime();
        attendanceTime.BackAM = txtBackAM.Text;
        attendanceTime.BackPM = txtBackPM.Text;
        attendanceTime.ComeAM = txtComeAM.Text;
        attendanceTime.ComePM = txtComePM.Text;
        if (AttendanceTimeManager.UpdateElement(attendanceTime,Server.MapPath(@"~/companyFiles/AttendanceTime.xml")))
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "alert('修改成功！')", true);
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "alert('修改失败！请重试！')", true);
        }
    }
}
